<%@page language="java" pageEncoding="gb2312"%>
<%@page import="java.util.*"%>
<%@page import="com.mysql.jdbc.Driver"%>
<%@page import="java.sql.*"%>
<%@page import="com.mysql.jdbc.ResultSetMetaData"%>

<%

if(session.getAttribute("username")==null)
{
    response.sendRedirect("error.jsp");
}

String path = request.getContextPath();
String basePath = request.getScheme() + "://" + 
  request.getServerName() + ":" + request.getServerPort() + 
  path + "/";

String driverName = "com.mysql.jdbc.Driver";
String DBUser = "*";
String DBPasswd = "*";
String DBName = "*";

String connUrl = "jdbc:mysql://localhost/" + DBName + "?useUnicode=true&characterEncoding=utf-8&user=" + 
  DBUser + "&password=" + DBPasswd;

Class.forName(driverName).newInstance();
Connection conn = DriverManager.getConnection(connUrl);
Statement stmt = conn.createStatement();
stmt.executeQuery("SET NAMES UTF8");

request.setCharacterEncoding("GB2312");

String fibercableid = request.getParameter("fibercableid");
String fibercableseq = request.getParameter("fibercableseq");
String relevanceid = request.getParameter("relevanceid");
String fibercount = request.getParameter("fibercount");

String length = request.getParameter("length");
String loss = request.getParameter("loss");
String laymethod = request.getParameter("laymethod");
String laylength = request.getParameter("laylength");
String mark = request.getParameter("mark");


String sql = "update fibercableinfo set fibercableseq = " + fibercableseq + ", fibercount = " + fibercount + ", length = " + length + ", loss = " + loss + ", laymethod = " + laymethod + ", laylength = " + laylength + ", mark = '" + mark + "' where fibercableid = " + fibercableid;

stmt.executeUpdate(sql);

stmt.executeQuery("commit");  //save
conn.close();
stmt.close();

response.sendRedirect("relevanceinfo.jsp");
%>
